-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add direct containers #788
Conversation
Since @hectorcorrea and @terrellt are already looking at this, I'm giving this a tentative 👍 as long as it can create things that look like what's been outlined in https://github.com/awead/sufia-pcdm. I'm happy to give this a try, if you want. |
end | ||
end | ||
|
||
describe "#to_a" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have a test for what happens when there are no files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added. See line 18
@jcoyne This implementation only address the scenario in which the direct container is created with a In other words, it does not let you create direct containers with I am asking because we might need support for |
@hectorcorrea I'm not seeing where isMemberRelation is used in PCDM (in the link you sent me). Can you help me find that? |
@jcoyne Look for
|
@jcoyne This PR is +1 for me, though. We could handle the scenario of supporting |
@jcoyne I didn't realize the Duraspace Wiki page does not open all the child pages by default. Search for "Ordering In Action" instead, open the "Ordering Creation Details..." link, and then you'll see the text that I mentioned under "Ordering - Create DirectContainer" |
@hectorcorrea the latest version lets you set |
e2eacce
to
ccc019d
Compare
def validate_options | ||
super | ||
if !options[:has_member_relation] && !options[:is_member_of_relation] | ||
raise ArgumentError, "You must specify a predicate for #{name}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{name} ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is name defined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the superclass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh, nope. Good catch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, yes, it is in the superclass: https://github.com/projecthydra/active_fedora/blob/master/lib/active_fedora/associations/builder/association.rb#L9
You can use the containers by calling: class FooHistory < ActiveFedora::Base directly_contains :files, has_member_relation: ::RDF::URI.new("http://example.com/hasFiles"), class_name: 'Thing' end if you don't specify a class_name it will default to ActiveFedora::File
Object.send(:remove_const, :FooHistory) | ||
end | ||
|
||
let(:file) { o.files.build } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found it somewhat non-intuitive to use build
rather than something line add
or create
but I guess since build
is the ActiveRecord standard we should go with it. (sincerely, the department of pointless comments)
@jcoyne The [1] https://gist.github.com/hectorcorrea/b7c80ce00914040c5ed7 |
I'm 👍 at this point. Any lingering issues? |
You can use the containers by calling:
if you don't specify a class_name it will default to ActiveFedora::File